//
//  YGSearchTitleView.m
//  SunshineMall
//
//  Created by 张艳江 on 2018/11/1.
//  Copyright © 2018年 张艳江. All rights reserved.
//

#import "SCSearchTitleView.h"

@implementation SCSearchTitleView

- (instancetype)initWithFrame:(CGRect)frame{
    
    self = [super initWithFrame:frame];
    if (self) {
        self.clipsToBounds = YES;
        self.layer.cornerRadius = self.height/2.0f;
        self.backgroundColor = BGColor;
        
        UIImageView *searchImage = [[UIImageView alloc]init];
        searchImage.frame = CGRectMake(15, 0, 15, 15);
        searchImage.centerY = self.height/2.0f;
        searchImage.image = [UIImage imageNamed:@"nav_icon_search"];
        [self addSubview:searchImage];
        
        self.searchTextField = [[UITextField alloc]initWithFrame:CGRectMake(40, 0, self.width - 35, self.height)];
        self.searchTextField.placeholder = @"搜索商品";
        self.searchTextField.tintColor = [UIColor redColor];
        self.searchTextField.font = [UIFont systemFontOfSize:15];
        self.searchTextField.clearButtonMode = UITextFieldViewModeWhileEditing;
        self.searchTextField.textColor = [UIColor blackColor];
        self.searchTextField.returnKeyType = UIReturnKeySearch;
        [self addSubview:self.searchTextField];
    }
    return self;
}

@end
